package compiladorcyclone;
import java.io.IOException;
import java_cup.runtime.*;

%%

%cup
%class AnalizadorMorfologico
%standalone

%unicode


%{
  String name;
%}
%{

/*public void run() throws IOException {

while ( !zzAtEOF ) yylex();
}*/
%}

numerico=[0-9]+
alfanumerico = [A-Z0-9]+
signo=[+-]

LineTerminator = \r|\n|\r\n   
WhiteSpace     = {LineTerminator} | [ \t\f]

   
%%

//{LineTerminator} {return new Symbol  (sym.SALTO);}
{WhiteSpace}       { /*no hace nada solo ignora*/ }
"(" { return new Symbol (sym.PARI);}
")" { return new Symbol (sym.PARD);}
"add" { return new Symbol (sym.ADD);}
"addc" { return new Symbol (sym.ADDC);}
"sub" { return new Symbol (sym.SUB);}
"subc" { return new Symbol (sym.SUBC);}
"and" { return new Symbol (sym.AND);}
"or" { return new Symbol (sym.OR);}
"xor" { return new Symbol (sym.XOR);}
"," { return new Symbol (sym.COMA);}
"sll" { return new Symbol (sym.SLL);}
"srl" { return new Symbol (sym.SRL);}
"sla" { return new Symbol (sym.SLA);}
"sra" { return new Symbol (sym.SRA);}
"rol" { return new Symbol (sym.ROL);}
"ror" { return new Symbol (sym.ROR);}
"ld" { return new Symbol (sym.LD);}
"st" { return new Symbol (sym.ST);}
"in" { return new Symbol (sym.IN);}
"out" { return new Symbol (sym.OUT);}
"bz" { return new Symbol (sym.BZ);}
"bnz" { return new Symbol (sym.BNZ);}
"bc" { return new Symbol (sym.BC);}
"bnc" { return new Symbol (sym.BNC);}
"jmp" { return new Symbol (sym.JMP);}
"call" { return new Symbol (sym.CALL);}
"ret" { return new Symbol (sym.RET);}
"reti" { return new Symbol (sym.RETI);}
"eni" { return new Symbol (sym.ENI);}
"disi" { return new Symbol (sym.DISI);}
"wait" { return new Symbol (sym.WAIT);}
"stdby" { return new Symbol (sym.STDBY);}

"r"{numerico} { return new Symbol (sym.registro, new String (  yytext() ));}
{signo}?{numerico} { return new Symbol (sym.numero, new String ( yytext() ));}
{signo}?"0x"{alfanumerico} {return new Symbol (sym.hexadecimal, new String ( yytext() )); }

. {System.out.print("Error en el flex: " + yytext() + "\n");System.exit(1); }


  







